<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>路由表添加</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">

		function checkValidate()
		{

			var destination=document.getElementById("destination").value;
			var nexthop=document.getElementById("nexthop").value;
			//判断是否为空
			if(destination==null||destination=="")
			{
				window.alertx("请输入目的CIDR！");
				return false;
			}
			if(nexthop==null||nexthop=="")
			{
				window.alertx("请输入下一跳IP！");
				return false;
			}
		}
	</script>
</head>
<body>
<ul class="nav nav-tabs">
	<li><a href="${ctx}/scene/sceneRouter/topologyRouterList?environmentId=${environmentId}&type=${type}">路由列表</a></li>
	<li class="active"><a href="${ctx}/scene/sceneRouter/routerTableAdd?routerId=${routerId}&environmentId=${environmentId}&type=${type}">路由表添加</a></li>
</ul><br/>
<sys:message content="${message}"/>
<form id="inputForm" modelAttribute="SceneRouterTable" action="${ctx}/scene/sceneRouter/routerTableSave" method="post" class="form-horizontal">
	<input type="hidden" id="routerId" name="routerId" value="${routerId}"/>
	<input type="hidden" id="environmentId" name="environmentId" value="${environmentId}"/>
	<input type="hidden" id="type" name="type" value="${type}">

	<div class="control-group" hidden>
		<label class="control-label">子网：</label>
		<div class="controls">
			<select id="subnetId" name="subnetId" class="input-xlarge">
				<c:forEach var="subnet" items="${subnetList}">
					<option value="${subnet.cidr}">${subnet.cidr}(${subnet.subnetName})</option>
				</c:forEach>
			</select>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label">目的CIDR：</label>
		<div class="controls">
			<input type="text" id="destination" name="destination" maxlength="64" class="input-xlarge required"/>
			<span class="help-inline"><font color="red">*</font> </span>
		</div>
	</div>
	<div class="control-group">
		<label class="control-label">下一跳：</label>
		<div class="controls">
			<input type="text"  id="nexthop" name="nexthop" maxlength="64" class="input-xlarge required"/>
			<span class="help-inline"><font color="red">* 下一跳的IP必须是路由器接口已连接的子网的一个IP</font> </span>
		</div>
	</div>
	<div class="form-actions">
		<shiro:hasPermission name="scene:sceneRouter:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存" onclick=" return checkValidate()"/>&nbsp;</shiro:hasPermission>
		<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
	</div>
</form>
</body>
</html>